<template>
  <div>
    <p>购买的商品数量:{{ count }}</p>
    <button @click="count = count + 1">+1</button>
    <button @click="addFn">+1</button>
    <button @click="addCountFn(5)">每次增加5</button>
    <button @click="subFn">-1</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: 1,
    };
  },
  methods: {
    addFn() {
      this.count++;
    },
    addCountFn(num) {
      this.count += num;
    },
    subFn() {
      this.count--;
    },
  },
};
</script>

<style>
</style>